﻿using Microsoft.Extensions.Configuration.Json;
using Microsoft.Extensions.Configuration;

namespace CommonTools;

/// <summary>
/// 读取配置文件
/// </summary>
public class AppConfigurationServices
{
    public static IConfiguration Configuration { get; set; }
    static AppConfigurationServices()
    {
        //ReloadOnChange = true 当AppSettings.json被修改时重新加载            
        Configuration = new ConfigurationBuilder()
            .SetBasePath(Directory.GetCurrentDirectory())
            .Add(new JsonConfigurationSource { Path = "appsettings.json", ReloadOnChange = true })
            .Build();
    }
}